<%@Page Language="VB"%>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.SqlClient" %>
<html><head>
<title>
The .NET DataSet and 
SqlDataAdapter Objects</title>
</head>
<body>
<span class="heading">The .NET DataSet 
and SqlDataAdapter Objects</span>
<hr width="350" align="left"/>
<div id="outError" runat="server">&nbsp;</div>
<asp:datagrid id="dgrResult"	 
AutoGenerateColumns="False" runat="server" > 
<Columns> 
<asp:TemplateColumn HeaderText="CateID"> 
<ItemTemplate> 
<asp:Label ID="CateID" _
Text='<%# DataBinder.Eval(Container.DataItem, _
"SubCateID").toString()%>' 
Runat=server /> 
</ItemTemplate> </asp:TemplateColumn>
 <asp:TemplateColumn HeaderText="CateName"> 
<ItemTemplate> 
<asp:Label ID="CateName" _
Text='<%# DataBinder.Eval(Container.DataItem, _
"SubCateName").toString()%>' 
Runat=server /> 
</ItemTemplate> </asp:TemplateColumn>
 <asp:TemplateColumn HeaderText="ItemName"> 
<ItemTemplate> 
<asp:Label ID="ItemName" _
Text='<%# DataBinder.Eval(Container.DataItem, _
"ItemName").toString()%>' 
Runat=server /> 
</ItemTemplate> </asp:TemplateColumn>
</Columns> </asp:DataGrid> 
<script language="vb" runat="server">
Sub Page_Load(ByVal sender As Object, _
ByVal e As EventArgs)
   Dim strConn As String
   Dim strSelect As String
   strConn= _
   ConfigurationSettings.appSettings("conn")
   
   Dim myDataSet As New DataSet()
   Try
      Dim myConn As New SqlConnection(strConn)      
      strSelect = "SELECT * From "
      strSelect +=" vwSalesCateItems"
      Dim myDataAdapter As New _
	SqlDataAdapter(strSelect, myConn)
      myDataAdapter.Fill(myDataSet,  _
	"vwSalesCateItems")     
   Catch objError As Exception
      	outError.innerHTML = _
	"<b>* Error while " & _
	"accessing data</b>.<br />" _
          	& objError.Message & "<br />" & _
	objError.Source
      Exit Sub  
   End Try     
    Dim myDataView As New _
   DataView(myDataSet.Tables("vwSalesCateItems"))
   dgrResult.DataSource = myDataView
   dgrResult.DataBind()   
End Sub
</script>
</body>
</html>
  